<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsppages/include/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=system_name%> - 船方自购物料</title>
	<base href="<%=basePath%>" />	
 	<meta http-equiv="pragma" content="no-cache" />
 	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<link type="image/x-icon" rel="shortcut icon" href="<%=basePath%>images/favicon.ico" />
	<link href="css/style.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath%>css/common.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath%>css/userlist.css" rel="stylesheet" type="text/css" />
	<script src="<%=basePath%>js/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/pagebar_cn.js"></script>
	<script type="text/javascript" src="fram/engine.js" ></script>
	<script type="text/javascript" src="fram/util.js" ></script>
	<script type="text/javascript" src="fram/interface/shipService.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/DatePicker/WdatePicker.js" defer="defer"></script>
</head>

<body oncontextmenu='return false'>

	<!--top begin-->
	<%@include file="/WEB-INF/jsppages/admin/head.jsp"%>
	<!--top end-->


<div class="wrap100 content">

   <!--left begin-->
	<%@include file="/WEB-INF/jsppages/admin/left.jsp"%>
    <!--left end-->
    
    
    <!--right begin-->
<div class="right">
            <div class="search">
                <form action="<%=basePath%>trade/shipShopMaterialList" method="GET">
                <table width="100%" border="0" cellspacing="0" cellpadding="5">
                  <tr>
                    <td width="5%"><img src="images/marking1.gif" width="41" height="44" alt="marking" /></td>
                    <td width="8%">快速查询</td>
                    <td width="25%">时间范围：<input type="text" name="startDate" id="startDate1" value="<fmt:formatDate value="${shipMaterialSearchCond.startDate}" pattern="yyyy-MM-dd"/>"  class="zi" style="width:75px;" onfocus="var end=document.getElementById('startDate2');WdatePicker({onpicked:function(){end.focus();},maxDate:end.value})"  autocomplete="off"/>
  					-<input type="text" name="startDate2" id="startDate2" value="<fmt:formatDate value="${shipMaterialSearchCond.startDate2}" pattern="yyyy-MM-dd"/>"  class="zi" style="width:75px;" onfocus="WdatePicker({minDate:'#F{$dp.$(\'startDate1\').value}'})"/></td>
                    </td>
                    <td width="20%">自购物料：<input type="text" name="details" value="${shipMaterialSearchCond.details}" style="width:100px;" /></td></td>
                    <td width="11%"><input type="hidden" id="id" name="id" value="${shipInfo.id}" />
                    <input type="submit" style="background:url(images/searchBtn.gif);width:116px;height:30px;border:0;margin:0;" value="" />
                    </td>
                    <td width="30%">
                    <jsp:useBean id="nowDate" class="java.util.Date"></jsp:useBean>
   					 现在是：${formatDate}<fmt:formatDate value="${nowDate}" type="both" dateStyle="full"/>
   					</td>
                    <td width="1%">&nbsp;</td>
                  </tr>
                </table>    
                </form>
        </div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="60"><h1>船方自购物料</h1></td>
              </tr>
            </table>
            <div class="rightContentTop">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="5%" align="center" bgcolor="#e3ecf1">船名</td>
                  <td width="13%">${shipInfo.shipName} </td>
                  <td width="5%" align="center" bgcolor="#e3ecf1">工程号</td>
                  <td width="14%">${shipInfo.jobnumber}</td>
                  <td width="7%" align="center" bgcolor="#e3ecf1">出库单号</td>
                  <td width="56%">${shipInfo.outNumber}</td>
                </tr>
              </table>
              <div class="subMenu">
               	  <ul>
                    	<li><a href="<%=basePath%>trade/shipLogList?id=${shipInfo.id}">船舶作业日志</a></li>
                        <li><a href="<%=basePath%>trade/shipShopMaterialList?id=${shipInfo.id}" class="current">船方自购物料</a></li>
                        <li><a href="<%=basePath%>trade/shipMainlandMaterialList?id=${shipInfo.id}">国内采购物料上船</a></li>
                        <li><a href="<%=basePath%>trade/shipFinalMaterialList?id=${shipInfo.id}">下船物料</a></li>
                        <li><a href="<%=basePath%>trade/shipDirectoryList?id=${shipInfo.id}">单证目录</a></li>
                    </ul>
                </div>				           
    </div>      
      
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="right"><span style="float:left;color:#666;">共找到<font color="red"> ${searchStat.totalCount} </font>条记录</span>
                <c:if test="${sessionScope.memberSessionInfo.userType.value<2}">
                <a href="javascript:;" onclick="addShopMaterial(${shipInfo.id})" style="font-weight:bold"><img src="images/add.gif" width="90" height="31" alt="添加" /></a>
                <!-- <a href="#"><img src="images/del.gif" width="90" height="31" alt="删除" /></a> -->
                </c:if>
                </td>
              </tr>
    	</table>
        <div class="rightContent1">

            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr class="td">
               <th width="3%" align="center" bgcolor="#f9f9f9"><input type="checkbox" name="checkbox4" id="checkbox4" /></th>
                <th width="3%" align="center" bgcolor="#f9f9f9">序号</th>
                <th width="6%" align="center" bgcolor="#f9f9f9">日期</th>
                <th width="6%" align="center" bgcolor="#f9f9f9">材料编码</th>
                <th width="10%" align="center" bgcolor="#f9f9f9">材料名称</th>
                <th width="8%" align="center" bgcolor="#f9f9f9">船方自购物料</th>
                <th width="6%" align="center" bgcolor="#f9f9f9">规格型号</th>
                <th width="7%" align="center" bgcolor="#f9f9f9">主计量单位</th>
                <th width="5%" align="center" bgcolor="#f9f9f9">数量</th>
                <th width="20%" align="center" bgcolor="#f9f9f9">备注</th>
                <th width="13%" align="center" bgcolor="#f9f9f9">录入员</th>
                <th width="10%" align="center" bgcolor="#f9f9f9">操作</th>
              </tr>
              <c:forEach var="shopMaterial" items="${shopMaterialList}">
              <tr>
                <td align="center"><input type="checkbox" name="checkbox" id="checkbox" /></td>
                <td align="center">${shopMaterial.id}</td>
                <td align="center"><fmt:formatDate value="${shopMaterial.startDate}" pattern="yyyy-MM-dd"/></td>
                <td align="center">${shopMaterial.material.code}</td>
                <td align="center">${shopMaterial.material.name}</td>
                <td align="left">${shopMaterial.details}</td>
                <td align="left">${shopMaterial.format}</td>
                <td align="left">${shopMaterial.unit}</td>
                <td align="left">${shopMaterial.amount}</td>
                <td align="left">${shopMaterial.remark}</td>
                <td align="left">
                	${shopMaterial.user.name} <fmt:formatDate value="${shopMaterial.createDate}" pattern="yyyy-MM-dd"/></td>
                <td align="left">
                	<c:if test="${sessionScope.memberSessionInfo.userType.value<2}">
                	<a href="javascript:;" onclick="delShopMaterial('${shopMaterial.id}');stopUp(event);"><img src="images/del1.jpg" alt="删除" /></a>
                	<a href="javascript:;" onclick="editShopMaterial('${shopMaterial.id}');stopUp(event);"><img src="images/modify.jpg" alt="修改" /></a>
                	</c:if>
                </td>
              </tr>
              </c:forEach>
			  <c:if test="${empty shopMaterialList}"><tr><td colspan="16" style="text-align:center">没有相关记录！</td></tr></c:if> 
              </table>
            </div>
        <script type="text/javascript">
		var pageControl = new wpagebar('pageControl');
		pageControl.argName = "pageIndex";
		pageControl.pageCount =${searchStat.pageCount};
		pageControl.load();		
  	</script>     
  	<div id="win_temp" style="display:none">
		<div id="shipDiv"><iframe name="shipDivFrame" id="shipDivFrame" frameborder="0" scrolling="no" width="500" height="280"></iframe></div>
	</div>
	<!-- 
    <div id="win_temp" style="display:none">
	<div id="winCon_1">
	<table class="tabView" style="margin-top:5px">
		<tr><th width="100">开始日期：</th><td>
		<input type="text" name="startDate0" id="startDate0" value="" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
		<input type="text" name="shopMaterialId0" id="shopMaterialId0" style="display:none"/></td></tr>
		<tr><th>材料编码：</th><td><input type="text" name="code0" id="code0" maxlength="100"/></td></tr>
		<tr><th>材料名称：</th><td><input type="text" name="name0" id="name0" maxlength="100"/></tr>
		<tr><th>船方自购物料：</th><td><textarea id="details0" name="details0" rows="4" cols="40"></textarea></td></tr>
		<tr><th>规格型号：</th><td><input type="text" name="format0" id="format0" value="" maxlength="100"/></td></tr>
		<tr><th>主计量单位：</th><td><input type="text" name="unit0" id="unit0" value="" maxlength="50"/></td></tr>
		<tr><th>数量：</th><td><input type="text" name="amount0" id="amount0" value="" maxlength="10" onKeyUp="clearNoNum(event,this)" onBlur="checkNum(this)"/></td></tr>
		<tr><th>备注：</th><td><textarea id="remark0" name="remark0" rows="4" cols="40"></textarea></td></tr>
		<tr><th>状态：</th><td><input type="radio" name="status0" checked="checked"/>启用 <input type="radio" name="status0"/>禁用</td></tr>
		<tr><td colspan="2" style="text-align:center;height:">
		<input type="hidden" id="userId0" name="userId0" value="${sessionScope.memberSessionInfo.userId}" />"
		<input type="hidden" id="shipInfoId0" name="shipInfoId0" value="${shipInfo.id}" />
		<input type="button" value=" 提 交 " class="btn1" onclick="submitShopMaterial()"/></td></tr>
	</table>
	</div>
	</div>
	 -->
    <script src="<%=basePath%>js/win.js" type="text/javascript"></script>
</div>
<script  type="text/javascript">
function addShopMaterial(shipInfoId){
	if(shipInfoId==''){
		 alert("请先选择船舶信息!");
		 return;
	}
	//WIN.show('添加船方自购物料信息',$('winCon_1'),{height:400});
	WIN.show('添加船方自购物料信息',$("shipDiv"),{width:500,height:280});
	$("shipDivFrame").src="<%=basePath%>trade/shipShopMaterialEdit?action=add&shipInfoId="+shipInfoId;
}
function editShopMaterial(id){
	WIN.show('编辑船方自购物料信息',$("shipDiv"),{width:500,height:280,afterClose:function(){reload();}});
	$("shipDivFrame").src="<%=basePath%>trade/shipShopMaterialEdit?action=modify&id="+id;
}
function submitStock(){
	WIN.win.style.display="none";
	WIN.winBg.style.display="none";
	WIN.showpg();
}
function afterSubmit(){
	reload();
}
function delShopMaterial(id){
	if(confirm("删除船舶日志，确定删除 ？")){
		WIN.showpg();
		shipService.delShopMaterialById(id,{
			callback:function(f){WIN.closepg();alert("删除成功");reload();},
			exceptionHandler:function(message){WIN.closepg();alert("删除失败，请重试");},
			errorHander:function(err){}
		})
	}
}
</script>
</body>
</html>
